const express = require('express')
const router = express.Router()

const toJson = (data) => {
    return JSON.stringify(data)
}

// router.get('/system/config/configKey/sys.user.initPassword', (req, res) => {
//     const data = {}
//     const body = {
//         "msg": "操作成功",
//         "code": 200,
//         data
//     }
//     res.send(toJson(body))
// })
router.get('/system/user/profile', (req, res) => {
    const body = {
        "msg": "操作成功",
        "postGroup": "董事长",
        "code": 200,
        "data": {
            "createBy": "admin",
            "createTime": "2024-06-30 11:27:11",
            "updateBy": null,
            "updateTime": null,
            "remark": "管理员",
            "userId": 1,
            "deptId": 103,
            "userName": "admin",
            "nickName": "领导",
            "email": "ry@163.com",
            "phonenumber": "15888888888",
            "sex": "1",
            "avatar": "",
            "password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
            "status": "0",
            "delFlag": "0",
            "loginIp": "183.162.254.237",
            "loginDate": "2024-07-24T13:50:23.000+08:00",
            "dept": {
                "createBy": null,
                "createTime": null,
                "updateBy": null,
                "updateTime": null,
                "remark": null,
                "deptId": 103,
                "parentId": 101,
                "ancestors": "0,100,101",
                "deptName": "研发部门",
                "orderNum": 1,
                "leader": "领导",
                "phone": null,
                "email": null,
                "status": "0",
                "delFlag": null,
                "parentName": null,
                "children": []
            },
            "roles": [
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "roleId": 1,
                    "roleName": "超级管理员",
                    "roleKey": "admin",
                    "roleSort": 1,
                    "dataScope": "1",
                    "menuCheckStrictly": false,
                    "deptCheckStrictly": false,
                    "status": "0",
                    "delFlag": null,
                    "flag": false,
                    "menuIds": null,
                    "deptIds": null,
                    "permissions": null,
                    "admin": true
                }
            ],
            "roleIds": null,
            "postIds": null,
            "roleId": null,
            "admin": true
        },
        "roleGroup": "超级管理员"
    }
    res.send(toJson(body))
})
router.get('/system/user/', (req, res) => {
    const body = {
        "msg": "操作成功",
        "code": 200,
        "roles": [
            {
                "createBy": null,
                "createTime": "2024-06-30 11:27:15",
                "updateBy": null,
                "updateTime": null,
                "remark": "普通角色",
                "roleId": 2,
                "roleName": "普通角色",
                "roleKey": "common",
                "roleSort": 2,
                "dataScope": "2",
                "menuCheckStrictly": true,
                "deptCheckStrictly": true,
                "status": "0",
                "delFlag": "0",
                "flag": false,
                "menuIds": null,
                "deptIds": null,
                "permissions": null,
                "admin": false
            }
        ],
        "posts": [
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 1,
                "postCode": "ceo",
                "postName": "董事长",
                "postSort": 1,
                "status": "0",
                "flag": false
            },
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 2,
                "postCode": "se",
                "postName": "项目经理",
                "postSort": 2,
                "status": "0",
                "flag": false
            },
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 3,
                "postCode": "hr",
                "postName": "人力资源",
                "postSort": 3,
                "status": "0",
                "flag": false
            },
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 4,
                "postCode": "user",
                "postName": "普通员工",
                "postSort": 4,
                "status": "0",
                "flag": false
            }
        ]
    }
    res.send(toJson(body))
})
router.get('/system/user/2', (req, res) => {
    const data = {
        "msg": "操作成功",
        "code": 200,
        "roleIds": [
            2
        ],
        "data": {
            "createBy": "admin",
            "createTime": "2024-06-30 11:27:11",
            "updateBy": null,
            "updateTime": null,
            "remark": "测试员",
            "userId": 2,
            "deptId": 105,
            "userName": "ry",
            "nickName": "领导",
            "email": "ry@qq.com",
            "phonenumber": "15666666666",
            "sex": "1",
            "avatar": "",
            "password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
            "status": "0",
            "delFlag": "0",
            "loginIp": "36.47.74.2",
            "loginDate": "2024-07-10T16:54:12.000+08:00",
            "dept": {
                "createBy": null,
                "createTime": null,
                "updateBy": null,
                "updateTime": null,
                "remark": null,
                "deptId": 105,
                "parentId": 101,
                "ancestors": "0,100,101",
                "deptName": "测试部门",
                "orderNum": 3,
                "leader": "领导",
                "phone": null,
                "email": null,
                "status": "0",
                "delFlag": null,
                "parentName": null,
                "children": []
            },
            "roles": [
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "roleId": 2,
                    "roleName": "普通角色",
                    "roleKey": "common",
                    "roleSort": 2,
                    "dataScope": "2",
                    "menuCheckStrictly": false,
                    "deptCheckStrictly": false,
                    "status": "0",
                    "delFlag": null,
                    "flag": false,
                    "menuIds": null,
                    "deptIds": null,
                    "permissions": null,
                    "admin": false
                }
            ],
            "roleIds": null,
            "postIds": null,
            "roleId": null,
            "admin": false
        },
        "postIds": [
            2
        ],
        "roles": [
            {
                "createBy": null,
                "createTime": "2024-06-30 11:27:15",
                "updateBy": null,
                "updateTime": null,
                "remark": "普通角色",
                "roleId": 2,
                "roleName": "普通角色",
                "roleKey": "common",
                "roleSort": 2,
                "dataScope": "2",
                "menuCheckStrictly": true,
                "deptCheckStrictly": true,
                "status": "0",
                "delFlag": "0",
                "flag": false,
                "menuIds": null,
                "deptIds": null,
                "permissions": null,
                "admin": false
            }
        ],
        "posts": [
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 1,
                "postCode": "ceo",
                "postName": "董事长",
                "postSort": 1,
                "status": "0",
                "flag": false
            },
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 2,
                "postCode": "se",
                "postName": "项目经理",
                "postSort": 2,
                "status": "0",
                "flag": false
            },
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 3,
                "postCode": "hr",
                "postName": "人力资源",
                "postSort": 3,
                "status": "0",
                "flag": false
            },
            {
                "createBy": "admin",
                "createTime": "2024-06-30 11:27:12",
                "updateBy": null,
                "updateTime": null,
                "remark": "",
                "postId": 4,
                "postCode": "user",
                "postName": "普通员工",
                "postSort": 4,
                "status": "0",
                "flag": false
            }
        ]
    }
    res.send(toJson(data))
})
router.get('/system/config/configKey/sys.user.initPassword', (req, res) => {
    const body = {
        "msg": "123456",
        "code": 200
    }
    res.send(toJson(body))
})
router.get('/system/dict/data/type/sys_normal_disable', (req, res) => {
    const body = {
        "msg": "操作成功",
        "code": 200,
        data : [
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:13:26",
                "updateBy": null,
                "updateTime": null,
                "remark": "正常状态",
                "dictCode": 6,
                "dictSort": 1,
                "dictLabel": "正常",
                "dictValue": "0",
                "dictType": "sys_normal_disable",
                "cssClass": "",
                "listClass": "primary",
                "isDefault": "Y",
                "status": "0",
                "default": true
            },
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:13:26",
                "updateBy": null,
                "updateTime": null,
                "remark": "停用状态",
                "dictCode": 7,
                "dictSort": 2,
                "dictLabel": "停用",
                "dictValue": "1",
                "dictType": "sys_normal_disable",
                "cssClass": "",
                "listClass": "danger",
                "isDefault": "N",
                "status": "0",
                "default": false
            }
        ]
    }
    res.send(toJson(body))
})
router.get('/system/dict/data/type/sys_user_sex', (req, res) => {
    const body = {
        "msg": "操作成功",
        "code": 200,
        data: [
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:13:24",
                "updateBy": null,
                "updateTime": null,
                "remark": "性别男",
                "dictCode": 1,
                "dictSort": 1,
                "dictLabel": "男",
                "dictValue": "0",
                "dictType": "sys_user_sex",
                "cssClass": "",
                "listClass": "",
                "isDefault": "Y",
                "status": "0",
                "default": true
            },
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:13:24",
                "updateBy": null,
                "updateTime": null,
                "remark": "性别女",
                "dictCode": 2,
                "dictSort": 2,
                "dictLabel": "女",
                "dictValue": "1",
                "dictType": "sys_user_sex",
                "cssClass": "",
                "listClass": "",
                "isDefault": "N",
                "status": "0",
                "default": false
            },
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:13:25",
                "updateBy": null,
                "updateTime": null,
                "remark": "性别未知",
                "dictCode": 3,
                "dictSort": 3,
                "dictLabel": "未知",
                "dictValue": "2",
                "dictType": "sys_user_sex",
                "cssClass": "",
                "listClass": "",
                "isDefault": "N",
                "status": "0",
                "default": false
            }
        ]
    }
    res.send(toJson(body))
})
router.get('/system/user/deptTree', (req, res) => {
    const body = {
        "msg": "操作成功",
        "code": 200,
        data: [
            {
                "id": 100,
                "label": "鼎和保险总公司",
                "children": [
                    {
                        "id": 101,
                        "label": "深圳总公司",
                        "children": [
                            {
                                "id": 103,
                                "label": "研发部门"
                            },
                            {
                                "id": 104,
                                "label": "市场部门"
                            },
                            {
                                "id": 105,
                                "label": "测试部门"
                            },
                            {
                                "id": 106,
                                "label": "财务部门"
                            },
                            {
                                "id": 107,
                                "label": "运维部门"
                            }
                        ]
                    },
                    {
                        "id": 102,
                        "label": "长沙分公司",
                        "children": [
                            {
                                "id": 108,
                                "label": "市场部门"
                            },
                            {
                                "id": 109,
                                "label": "财务部门"
                            }
                        ]
                    }
                ]
            }
        ]
    }
    res.send(toJson(body))
})
router.get('/getInfo', (req, res) => {
    const body = {
        "msg": "操作成功",
        "code": 200,
        "permissions": [
            "*:*:*"
        ],
        "roles": [
            "admin"
        ],
        "user": {
            "createBy": "admin",
            "createTime": "2023-04-23 16:11:38",
            "updateBy": null,
            "updateTime": null,
            "remark": "管理员",
            "userId": 1,
            "deptId": 103,
            "userName": "admin",
            "nickName": "领导",
            "email": "ry@163.com",
            "phonenumber": "15888888888",
            "sex": "1",
            "avatar": "",
            "password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
            "status": "0",
            "delFlag": "0",
            "loginIp": "222.247.212.187",
            "loginDate": "2024-06-25T11:06:24.000+08:00",
            "dept": {
                "createBy": null,
                "createTime": null,
                "updateBy": null,
                "updateTime": null,
                "remark": null,
                "deptId": 103,
                "parentId": 101,
                "ancestors": "0,100,101",
                "deptName": "研发部门",
                "orderNum": 1,
                "leader": "领导",
                "phone": null,
                "email": null,
                "status": "0",
                "delFlag": null,
                "parentName": null,
                "children": []
            },
            "roles": [
                {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "roleId": 1,
                    "roleName": "超级管理员",
                    "roleKey": "admin",
                    "roleSort": 1,
                    "dataScope": "1",
                    "menuCheckStrictly": false,
                    "deptCheckStrictly": false,
                    "status": "0",
                    "delFlag": null,
                    "flag": false,
                    "menuIds": null,
                    "deptIds": null,
                    "permissions": null,
                    "admin": true
                }
            ],
            "roleIds": null,
            "postIds": null,
            "roleId": null,
            "admin": true
        }
    }
    res.send(toJson(body))
})
router.get('/getRouters', (req, res) => {
    const body = {
        "msg": "操作成功",
        "code": 200,
        data: [
            {
                "name": "System",
                "path": "/system",
                "hidden": false,
                "redirect": "noRedirect",
                "component": "Layout",
                "alwaysShow": true,
                "meta": {
                    "title": "系统管理",
                    "icon": "system",
                    "noCache": false,
                    "link": null
                },
                "children": [
                    {
                        "name": "User",
                        "path": "user",
                        "hidden": false,
                        "component": "system/user/index",
                        "meta": {
                            "title": "用户管理",
                            "icon": "user",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Role",
                        "path": "role",
                        "hidden": false,
                        "component": "system/role/index",
                        "meta": {
                            "title": "角色管理",
                            "icon": "peoples",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Menu",
                        "path": "menu",
                        "hidden": false,
                        "component": "system/menu/index",
                        "meta": {
                            "title": "菜单管理",
                            "icon": "tree-table",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Dept",
                        "path": "dept",
                        "hidden": false,
                        "component": "system/dept/index",
                        "meta": {
                            "title": "部门管理",
                            "icon": "tree",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Post",
                        "path": "get",
                        "hidden": false,
                        "component": "system/get/index",
                        "meta": {
                            "title": "岗位管理",
                            "icon": "get",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Dict",
                        "path": "dict",
                        "hidden": false,
                        "component": "system/dict/index",
                        "meta": {
                            "title": "字典管理",
                            "icon": "dict",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Config",
                        "path": "config",
                        "hidden": false,
                        "component": "system/config/index",
                        "meta": {
                            "title": "参数设置",
                            "icon": "edit",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Notice",
                        "path": "notice",
                        "hidden": false,
                        "component": "system/notice/index",
                        "meta": {
                            "title": "通知公告",
                            "icon": "message",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Log",
                        "path": "log",
                        "hidden": false,
                        "redirect": "noRedirect",
                        "component": "ParentView",
                        "alwaysShow": true,
                        "meta": {
                            "title": "日志管理",
                            "icon": "log",
                            "noCache": false,
                            "link": null
                        },
                        "children": [
                            {
                                "name": "Operlog",
                                "path": "operlog",
                                "hidden": false,
                                "component": "monitor/operlog/index",
                                "meta": {
                                    "title": "操作日志",
                                    "icon": "form",
                                    "noCache": false,
                                    "link": null
                                }
                            },
                            {
                                "name": "Logininfor",
                                "path": "logininfor",
                                "hidden": false,
                                "component": "monitor/logininfor/index",
                                "meta": {
                                    "title": "登录日志",
                                    "icon": "logininfor",
                                    "noCache": false,
                                    "link": null
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "name": "Monitor",
                "path": "/monitor",
                "hidden": false,
                "redirect": "noRedirect",
                "component": "Layout",
                "alwaysShow": true,
                "meta": {
                    "title": "系统监控",
                    "icon": "monitor",
                    "noCache": false,
                    "link": null
                },
                "children": [
                    {
                        "name": "Online",
                        "path": "online",
                        "hidden": false,
                        "component": "monitor/online/index",
                        "meta": {
                            "title": "在线用户",
                            "icon": "online",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Job",
                        "path": "job",
                        "hidden": false,
                        "component": "monitor/job/index",
                        "meta": {
                            "title": "定时任务",
                            "icon": "job",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Druid",
                        "path": "druid",
                        "hidden": false,
                        "component": "monitor/druid/index",
                        "meta": {
                            "title": "数据监控",
                            "icon": "druid",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Server",
                        "path": "server",
                        "hidden": false,
                        "component": "monitor/server/index",
                        "meta": {
                            "title": "服务监控",
                            "icon": "server",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "Cache",
                        "path": "cache",
                        "hidden": false,
                        "component": "monitor/cache/index",
                        "meta": {
                            "title": "缓存监控",
                            "icon": "redis",
                            "noCache": false,
                            "link": null
                        }
                    },
                    {
                        "name": "CacheList",
                        "path": "cacheList",
                        "hidden": false,
                        "component": "monitor/cache/list",
                        "meta": {
                            "title": "缓存列表",
                            "icon": "redis-list",
                            "noCache": false,
                            "link": null
                        }
                    }
                ]
            },
        ]
    }
    res.send(toJson(body))
})
router.get('/system/user/list', (req, res) => {
    const body = {
        "total": 2,
        "rows": [
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:11:38",
                "updateBy": null,
                "updateTime": null,
                "remark": "管理员",
                "userId": 1,
                "deptId": 103,
                "userName": "admin",
                "nickName": "领导",
                "email": "ry@163.com",
                "phonenumber": "15888888888",
                "sex": "1",
                "avatar": "",
                "password": null,
                "status": "0",
                "delFlag": "0",
                "loginIp": "114.92.143.60",
                "loginDate": "2024-06-25T20:12:37.000+08:00",
                "dept": {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "deptId": 103,
                    "parentId": null,
                    "ancestors": null,
                    "deptName": "研发部门",
                    "orderNum": null,
                    "leader": "领导",
                    "phone": null,
                    "email": null,
                    "status": null,
                    "delFlag": null,
                    "parentName": null,
                    "children": []
                },
                "roles": [],
                "roleIds": null,
                "postIds": null,
                "roleId": null,
                "admin": true
            },
            {
                "createBy": "admin",
                "createTime": "2023-04-23 16:11:38",
                "updateBy": null,
                "updateTime": null,
                "remark": "测试员",
                "userId": 2,
                "deptId": 105,
                "userName": "ry",
                "nickName": "领导",
                "email": "ry@qq.com",
                "phonenumber": "15666666666",
                "sex": "1",
                "avatar": "",
                "password": null,
                "status": "0",
                "delFlag": "0",
                "loginIp": "124.17.86.48",
                "loginDate": "2024-06-25T18:05:03.000+08:00",
                "dept": {
                    "createBy": null,
                    "createTime": null,
                    "updateBy": null,
                    "updateTime": null,
                    "remark": null,
                    "deptId": 105,
                    "parentId": null,
                    "ancestors": null,
                    "deptName": "测试部门",
                    "orderNum": null,
                    "leader": "领导",
                    "phone": null,
                    "email": null,
                    "status": null,
                    "delFlag": null,
                    "parentName": null,
                    "children": []
                },
                "roles": [],
                "roleIds": null,
                "postIds": null,
                "roleId": null,
                "admin": false
            }
        ],
        "code": 200,
        "msg": "查询成功"
    }
    res.send(toJson(body))
})



module.exports = router